/*
 * Created on Sep 19, 2005 12:54:04 PM
 * 
 * $Id$
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package tripleo.fmsys.demos;

import java.io.IOException;
import java.util.HashMap;

import tripleo.fmsys.*;
import tripleo.fmsys.IComponent;

public class JavaHelloDemo implements IComponent {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		fmsystem o = new fmsystem(new FSAccess("/fm"));
		new JavaHelloDemo().start(o);
	}

	public void start(fmsystem syst) throws IOException {

		FMResponse<String> resp;
		FMResponse<fmcmpt> comm;

		comm= syst.component("/fmdemo/hello-in-py");
		if (comm.code() == Code.OK) {
			resp = comm.get().call("hello", new HashMap());
			if (resp.code() == Code.OK) {
				System.out.append(resp.value());
			} else {
				System.out.append(""+resp.code());
				System.out.append(resp.exception());
			}
		} else {
			System.out.append(""+comm.code());
			System.out.append(comm.exception());
		}
	}
}

